package com.example.recycler.myapplication;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import rx.Observable;
import rx.Subscriber;

public class MainActivity extends AppCompatActivity {
    private TextView mTvCt;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mTvCt = (TextView) findViewById(R.id.tv_ct);
    }

    public void go1(View v) {
        //观察者
        Subscriber<String[]> subscriber=new Subscriber<String[]>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(String[] s) {
                System.out.println("s = [" + s.toString() + "]");
            }
        };
        //俩作用：1.实例化被观察者  2.设置我们被观察者要发出去的数据
//        Observable<String> observable=Observable.just("风华绝世","两仪式","倾国倾城","黑贞德");
        Observable<String[]> observable=Observable.just(new String[]{"风华绝世","两仪式","倾国倾城","黑贞德"});
        //为被观察者设置观察者
        observable.subscribe(subscriber);
    }

    public void go2(View v) {


    }

    public void go3(View v) {


    }

    public void go4(View v) {


    }
}
